//
// Created on 2025/11/18.
// Author 秦光磊.

#ifndef PERIODICTABLEOFCHEMICALELEMENTSHM6_DRAW_DISTRIBUTION_H
#define PERIODICTABLEOFCHEMICALELEMENTSHM6_DRAW_DISTRIBUTION_H
#include "drawbridge/draw_component.h"
#include "napi/native_api.h"
#include "render/egl_core.h"
class DrawDistribution {
public:
    ~DrawDistribution();
    static napi_value DrawDistributionBusiness(napi_env env, napi_callback_info info);
    static bool DrawUpPart(EGLCore *eglCore, std::vector<GLfloat> &startVector, int startSize, float upPartWidth,
                           float upPartHeight);
    static bool DrawMiddlePart(EGLCore *eglCore, std::vector<GLfloat> &middlePartStart, int startSize,
                               float middlePartWidth, float middlePartHeight);
    static bool DrawDownPart(EGLCore *eglCore, std::vector<GLfloat> &downPartStart, int startSize, float downPartWidth,
                             float downPartHeight);
    static bool DrawEnergySignOrDistributionViaParen(EGLCore *eglCore, std::vector<GLfloat> &startVector, int startSize,
                                                     float drawAreaWidth, float drawAreaHeight, int functionFlag,
                                                     int *geometryAttribute, int attrSize);
    static bool DrawElectronConfiguration(EGLCore *eglCore, std::vector<GLfloat> &configStartVector, int startSize,
                                          float configAreaWidth, float configAreaHeight);
    void renderLoop();


    // 设置全局变量,函数执行过程中全部共用
    static EGLCore *eglCoreForDistribute;
    static DrawComponent *drawComponent;
    static EGLDisplay eglDisplay;
    static EGLSurface eglSurface;
    static GLuint program;
    // 画布宽与高，画布的宽度是drawWidth，高度是drawHeight，中心为原点，在此基础上绘制图像
    static float drawWidth;
    static float drawHeight;
    static float screenRatio;
    // 核外电子轨道上电子分布数据
    static std::vector<int> electronDistributionData;
    // 核外电子排布背景色
    static GLfloat distributeBackgroundColor[4];
};
#endif // PERIODICTABLEOFCHEMICALELEMENTSHM6_DRAW_DISTRIBUTION_H
